#include "listwidget.h"

ListWidget::ListWidget(QWidget* parent) : QListWidget(parent) {
    setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
}

void ListWidget::enterEvent(QEvent*) {
    setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAsNeeded);
}

void ListWidget::leaveEvent(QEvent*) {
    setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
}

void ListWidget::addWdiget(QWidget* widget) {
    QListWidgetItem* item = new QListWidgetItem(this);

    addItem(item);
    setItemWidget(item, widget);
    item->setSizeHint(QSize(172, 74));
}
